]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensions-tool: Log existing errors
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 14 Mar 2020 10:00:49 +0000 (11:00 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 5 Apr 2020 11:42:50 +0000 (13:42 +0200)
In many cases we currently only indicate failure in the return value,
which is easily missed. Print some meaningful errors instead.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2391

subprojects/extensions-tool/src/command-info.c
subprojects/extensions-tool/src/command-list.c
subprojects/extensions-tool/src/command-prefs.c
subprojects/extensions-tool/src/command-uninstall.c

index e280023e1ce6b783019fd6c27dc06b5b50e795f5..61492a5d3ac418db57f30a83ff9d6e25589636d0 100644 (file)
@@ -46,13 +46,19 @@ show_extension_info (const char *uuid)
                                      NULL,
                                      &error);
   if (response == NULL)
-    return FALSE;
+    {
+      g_printerr (_("Failed to connect to GNOME Shell\n"));
+      return FALSE;
+    }
 
   asv = g_variant_get_child_value (response, 0);
   info = g_variant_dict_new (asv);
 
   if (!g_variant_dict_contains (info, "uuid"))
-    return FALSE;
+    {
+      g_printerr (_("Extension “%s” doesn't exist\n"), uuid);
+      return FALSE;
+    }
 
   print_extension_info (info, DISPLAY_DETAILED);
 
index bc021fd14ef5fc924250916a4c1bc998421a5880..62db4d9d3e68189e8a770e6d258846bc3ac6be44 100644 (file)
@@ -60,7 +60,10 @@ list_extensions (ListFilterFlags filter, DisplayFormat format)
                                      NULL,
                                      &error);
   if (response == NULL)
-    return FALSE;
+    {
+      g_printerr (_("Failed to connect to GNOME Shell\n"));
+      return FALSE;
+    }
 
   extensions = g_variant_get_child_value (response, 0);
 
index 86799eafc582b679045f7d0a47110c222fc519eb..25d1626c4d2b8cb127813a38acda398f4b2f1067 100644 (file)
@@ -47,17 +47,26 @@ launch_extension_prefs (const char *uuid)
                                      NULL,
                                      &error);
   if (response == NULL)
-    return FALSE;
+    {
+      g_printerr (_("Failed to connect to GNOME Shell"));
+      return FALSE;
+    }
 
   asv = g_variant_get_child_value (response, 0);
   info = g_variant_dict_new (asv);
 
   if (!g_variant_dict_contains (info, "uuid"))
-    return FALSE;
+    {
+      g_printerr (_("Extension “%s” doesn't exist\n"), uuid);
+      return FALSE;
+    }
 
   g_variant_dict_lookup (info, "hasPrefs", "b", &has_prefs);
   if (!has_prefs)
-    return FALSE;
+    {
+      g_printerr (_("Extension “%s” doesn't have preferences\n"), uuid);
+      return FALSE;
+    }
 
   g_dbus_proxy_call_sync (proxy,
                           "OpenExtensionPrefs",
index 5974e098e1dc333da99bff6d05342de33a1264a5..4b902f40373b17d3409d000e12a83bb905e5668f 100644 (file)
@@ -45,10 +45,16 @@ uninstall_extension (const char *uuid)
                                      NULL,
                                      &error);
   if (response == NULL)
-    return FALSE;
+    {
+      g_printerr (_("Failed to connect to GNOME Shell"));
+      return FALSE;
+    }
 
   g_variant_get (response, "(b)", &success);
 
+  if (!success)
+    g_printerr (_("Failed to uninstall “%s”\n"), uuid);
+
   return success;
 }